package cn.edu.scau.cmi.chenenting.composite.consistent;

import java.util.ArrayList;

public class Leaf implements Component {
	private String name;
	private Composite father;
	private ArrayList<Component> organization;
	
	public Leaf(String name) {
		this.name = name;
	}
	
	public String getName() {
		return this.name;
	}
	
	public Composite getFather() {
		return this.father;
	}
	
	public void display(String preStr) {
		Composite.result += preStr + "-" + name + "\n";
	}

	public void setFather(Composite father) {
		this.father = father;
	}
	
    public void add(Component child) {
    	System.out.println("Can not add a component to a leaf.");
    }
    
    public void remove(Component child) {
    	System.out.println("Can not remove a component to a leaf.");
    }
    
    public ArrayList<Component> getChild() {
        return organization;
    }
}
